
// source idl: com.erp.organization.dao.idl.OrganizationDao.java

#ifndef ORGANIZATIONDAO_STUB_4_APP_H
#define ORGANIZATIONDAO_STUB_4_APP_H

#include <string>
#include <sstream>
#include "app_platform/cmd_obj.h"
#include "c2cent/base/basestub4app.h"
#include "app_platform/cntl_info.h"
#include "app_platform/intf_serializable.h"
#include "app_platform/intf_service_object.h"
#include <set>	
#include <map>	
#include <vector>	
#include "erp/organization/ddo/branchddo_organization.h"	
#include "erp/organization/ddo/organizationfilterddo_organization.h"	
#include "intf_organizationdao.h"

namespace erp
{
namespace organization
{
namespace dao
{
	#define ORGANIZATIONDAO_STUB4APP_VERSION "ERP_ORGANIZATION_DAO___ORGANIZATIONDAO__STUB4APP_VERSION__1.0 2013-10-23 11:04:01"
    const std::string ORGANIZATIONDAO_STUB4APP_NOUSE = ORGANIZATIONDAO_STUB4APP_VERSION;

	const uint32_t ORGANIZATIONDAO_DELETEBRANCH_REQ_CMD_ID = 0xC04E1802; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID = 0xC04E8802; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_FINDBRANCH_REQ_CMD_ID = 0xC04E1804; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID = 0xC04E8804; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_GETBRANCH_REQ_CMD_ID = 0xC04E1803; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID = 0xC04E8803; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_MODIFYBRANCH_REQ_CMD_ID = 0xC04E1801; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID = 0xC04E8801; /// 回应命令号
	


	const uint16_t ORGANIZATIONDAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号

///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CDeleteBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_DELETEBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CDeleteBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CFindBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::ddo::COrganizationFilterDdo filter;
		std::string inReserve;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_FINDBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			filter.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CFindBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & total;
			bs & branch;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CGetBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_GETBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CGetBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & branch;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CModifyBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::ddo::CBranchDdo branch;
		std::string inReserve;
		std::string errmsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_MODIFYBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			branch.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct CModifyBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	class COrganizationDaoStub4App : public c2cent::CBaseStub4App, public IOrganizationDao,public IOrganizationDaoAsyc{
		public:
			uint32_t DeleteBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
			);
			
			uint32_t SendDeleteBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
		    );
		    uint32_t RecvDeleteBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
		    );
		    
		    uint32_t RecvDeleteBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
		    );
		    
		    uint32_t GetDeleteBranchRespCmd(
		    );
			uint32_t FindBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
			);
			
			uint32_t SendFindBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve
		    );
		    uint32_t RecvFindBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
		    );
		    
		    uint32_t RecvFindBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
		    );
		    
		    uint32_t GetFindBranchRespCmd(
		    );
			uint32_t GetBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
			);
			
			uint32_t SendGetBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
		    );
		    uint32_t RecvGetBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
		    );
		    
		    uint32_t RecvGetBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
		    );
		    
		    uint32_t GetGetBranchRespCmd(
		    );
			uint32_t ModifyBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
			);
			
			uint32_t SendModifyBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve
		    );
		    uint32_t RecvModifyBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::string& outReserve
		    );
		    
		    uint32_t RecvModifyBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::string& outReserve
		    );
		    
		    uint32_t GetModifyBranchRespCmd(
		    );
	};
	
	/**
	 *
 	 * 删除分支机构（逻辑）
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param Set branchId: 需删除的分支机构的ID，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param Map errorCode: 删除失败的错误码 		
		 *@param Map errorMsg: 删除失败的错误信息 		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t COrganizationDaoStub4App::DeleteBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CDeleteBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branchId = branchId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CDeleteBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t COrganizationDaoStub4App::SendDeleteBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
	)
	{
	    CDeleteBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branchId = branchId;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t COrganizationDaoStub4App::RecvDeleteBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CDeleteBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::RecvDeleteBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CDeleteBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::GetDeleteBranchRespCmd(
	)
	{	    
	    return ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID;
	}	
	/**
	 *
 	 * 根据过滤条件查询支机构列表信息
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param OrganizationFilterDdo filter: 过滤器，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param uint32_t total: 分支机构总数 		
		 *@param Vector branch: 分支机构列表信息 		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t COrganizationDaoStub4App::FindBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{
		CFindBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.filter = filter;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.branch = branch;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CFindBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t COrganizationDaoStub4App::SendFindBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve
	)
	{
	    CFindBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.filter = filter;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t COrganizationDaoStub4App::RecvFindBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CFindBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::RecvFindBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CFindBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::GetFindBranchRespCmd(
	)
	{	    
	    return ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID;
	}	
	/**
	 *
 	 * 根据分支机构ID批量获取分支机构信息
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param Set branchId: 需获取的分支机构的ID，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param Map errorCode: 获取失败的错误码 		
		 *@param Map errorMsg: 获取失败的错误信息 		
		 *@param Map branch: 获取成功的分支机构信息 		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t COrganizationDaoStub4App::GetBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{
		CGetBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branchId = branchId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.branch = branch;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t COrganizationDaoStub4App::SendGetBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
	)
	{
	    CGetBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branchId = branchId;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t COrganizationDaoStub4App::RecvGetBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::RecvGetBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			branch  = oResp.branch;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::GetGetBranchRespCmd(
	)
	{	    
	    return ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID;
	}	
	/**
	 *
 	 * 添加/修改分支机构；传入分支机构ID不为0时则进行修改，反之则进行添加；不能进行逻辑删除
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param BranchDdo branch: 分支机构PO，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t COrganizationDaoStub4App::ModifyBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CModifyBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branch = branch;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CModifyBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t COrganizationDaoStub4App::SendModifyBranch(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve
	)
	{
	    CModifyBranchReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.branch = branch;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    if (m_pSvcCntl == NULL)
        {
            m_sErrMsg = "error, rCntlInfo is temporary variable";
            return 0xEE0041;
        }
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t COrganizationDaoStub4App::RecvModifyBranch(
				const CCntlInfo& rCntlInfo,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CModifyBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::RecvModifyBranch(
		  		CCmdObj& rCmd,
				std::string& errmsg,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CModifyBranchResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t COrganizationDaoStub4App::GetModifyBranchRespCmd(
	)
	{	    
	    return ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID;
	}	
		
}
}
}

#endif /* ORGANIZATIONDAO_STUB_4_APP_H */
